package james.weka;

import java.io.File;

import james.weka.exception.WekaFormatException;
/**
 * This is the interface for the future work so that cloud source will helps to build the datbase and meke the classification.
 * It is not sopported for the demostration app.
 * @author James
 *
 */
public interface WekaRestService {
	
	/**
	 * This method try to download a classifier model from server respected to the relation specified, and then save the model
	 * to a file.
	 * @param relation
	 * @return A file, name by the relation, containing a classifier model.
	 * @throws WekaFormatException If the corresponding file is not found.
	 */
	File downloadClassifierModel(String relation)throws WekaFormatException;
	
	/**
	 * Upload a model file to the server, name of the model will be specify by the relation of arff file.
	 * @param modelFile The model file to be uploaded.
	 * @throws WekaFormatException If the corresponding file is not found or the TODO file is not a model.
	 */
	void uploadClassifierModel(File modelFile)throws WekaFormatException;
	
	/**
	 * Download the arff file with no data section, used to construct test arff.
	 * @param relation The filename, specified by the arff relation.
	 * @return The downloaded file.
	 * @throws WekaFormatException If the file is not found.
	 */
	File downloadStructure(String relation)throws WekaFormatException;
	
	/**
	 * Upload the stucture file to server, file name specified by the arff relation.
	 * @param structureFile
	 * @throws WekaFormatException if the file is not arff.
	 */
	void uploadStructure(File structureFile)throws WekaFormatException;
	
	/**
	 * Classify the data set with only one sample.
	 * @param singelSampleFile The arff file with one sample to be classified.
	 * @return The classification result, containing classlabel and TODO confidence.
	 * @throws WekaFormatException
	 */
	ClassifyResult classify(File singelSampleFile)throws WekaFormatException;
	
	/**
	 * Upload a arff file for in order to build the classifier model, the model will then be name by the relation specified in the arff file.
	 * @param datasetArff The arff file to be uploaded.
	 * @throws WekaFormatException File is not an arff file.
	 */
	void uploadTrainingDataSet(File datasetArff)throws WekaFormatException;
	
	/**
	 * Test if the RESTful service is available.
	 * @return
	 */
	boolean isAvailable();

}
